package com.a3dweijing.wetouch2.Util;

import android.content.Context;

import com.a3dweijing.wetouch2.bean.EvenMsg;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

/**
 * Created by Administrator on 2018/3/29.
 */

public class EvenBusUtil {
    //注册事件
    public static void register(Object object) {
        if (!EventBus.getDefault().isRegistered(object)) {
            EventBus.getDefault().register(object);
        }
    }
    //解除
    public static void unregister(Object object) {
        if (EventBus.getDefault().isRegistered(object)) {
            EventBus.getDefault().unregister(object);
        }
    }
    //发送消息
    public static void post(EvenMsg evenMsg) {
        EventBus.getDefault().post(evenMsg);
    }


//    @Subscribe(threadMode = ThreadMode.MAIN) //在ui线程执行
//    public void onDataSynEvent(EvenMsg evenMsg) {
//
//    }
}
